package com.lvmama.rhino.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.lvmama.rhino.mapper.FunnelMapper;
import com.lvmama.rhino.pojo.StatisticCode;
import com.lvmama.rhino.pojo.funnel.FlowStatisticsFunnel;
import com.lvmama.rhino.service.FunnelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("funnelService")
public class FunnelServiceImpl implements FunnelService {

    @Autowired
    private FunnelMapper funnelMapper;

    @Override
    public void insertFunnel(FlowStatisticsFunnel funnel){
        funnelMapper.insertFunnel(funnel);
    }

    @Override
    public void insertFunnelDetail(FlowStatisticsFunnel funnel){
        funnelMapper.insertFunnelDetail(funnel);
    }

    @Override
    public FlowStatisticsFunnel selectFunnel(FlowStatisticsFunnel funnel){
        return funnelMapper.selectFunnel(funnel);
    }


    @Override
    public List<FlowStatisticsFunnel> selectFunnelDetail(FlowStatisticsFunnel funnel){
        return funnelMapper.selectFunnelDetail(funnel);
    }

    @Override
    public PageInfo<FlowStatisticsFunnel> selectAllFunnel(FlowStatisticsFunnel funnel){
        PageHelper.startPage(funnel.getPage(), funnel.getPageSize());
        List<FlowStatisticsFunnel> funnelList = funnelMapper.selectAllFunnel(funnel);
        PageInfo<FlowStatisticsFunnel> page = new PageInfo<FlowStatisticsFunnel>(funnelList);
        return page;
    }

    @Override
    public void updateFunnel(FlowStatisticsFunnel funnel){
        funnelMapper.updateFunnel(funnel);
    }

    @Override
    public void updateFunnelDetail(FlowStatisticsFunnel funnel){
        funnelMapper.updateFunnelDetail(funnel);
    }

    @Override
    public void deleteFunnel(FlowStatisticsFunnel funnel){
        funnelMapper.deleteFunnel(funnel);
    }

    @Override
    public void deleteFunnelDetail(FlowStatisticsFunnel funnel){
        funnelMapper.deleteFunnelDetail(funnel);
    }
}
